	//页面左边的树形结构
		var setting = {
			view: {
				addHoverDom: addHoverDom,
				removeHoverDom: removeHoverDom,
				selectedMulti: true
			},
			edit: {
				enable: true,
				editNameSelectAll: true,
				showRemoveBtn: showRemoveBtn,
				showRenameBtn: showRenameBtn
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				beforeDrag: beforeDrag,
				beforeEditName: beforeEditName,
				beforeRemove: beforeRemove,
				beforeRename: beforeRename,
				onRemove: onRemove,
				onRename: onRename,
				onClick: treenodeClick
			}
		};

		var zNodes = [{
				id: 0,
				pId: -1,
				name: "吉林江机特种工业有限公司",
				open: true
			},
			{
				id: 1,
				pId: 0,
				name: "七分厂"
			},
			{
				id: 2,
				pId: 0,
				name: "二分厂"
			},
			{
				id: 3,
				pId: 0,
				name: "信息管理部"
			},
			{
				id: 4,
				pId: 1,
				name: "电装车间"
			},
		];
		var log, className = "dark";

		function beforeDrag(treeId, treeNodes) {
			return false;
		}

		function beforeEditName(treeId, treeNode) { //
			className = (className === "dark" ? "" : "dark");
			showLog("[ " + getTime() + " beforeEditName ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.name);
			console.log("1" + treeNode.name + "pId:" + treeNode.pId + "id:" + treeNode.id);
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.selectNode(treeNode);
			return treeNode.name;
		}

		function beforeRemove(treeId, treeNode) {
			className = (className === "dark" ? "" : "dark");
			showLog("[ " + getTime() + " beforeRemove ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.name);
			console.log("2" + treeNode.name + "pId:" + treeNode.pId + "id:" + treeNode.id);
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.selectNode(treeNode);
			return confirm("确认删除 节点 -- " + treeNode.name + " 吗？");
		}

		function onRemove(e, treeId, treeNode) {
			showLog("[ " + getTime() + " onRemove ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.name);
			console.log("3" + treeNode.name + "pId:" + treeNode.pId + "id:" + treeNode.id);
		}

		function beforeRename(treeId, treeNode, newName) {
			className = (className === "dark" ? "" : "dark");
			showLog("[ " + getTime() + " beforeRename ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.name);
			console.log("4" + treeNode.name + "pId:" + treeNode.pId + "id:" + treeNode.id);
			if(newName.length == 0) {
				alert("节点名称不能为空.");
				var zTree = $.fn.zTree.getZTreeObj("treeDemo");
				setTimeout(function() {
					zTree.editName(treeNode)
				}, 10);
				return false;
			}
			return true;
		}
		//获取点击节点的子节点--开始
		function treenodeClick(event, treeId, treeNode, clickFlag) {
			//此处treeNode 为当前节点
			var str = '';
			str = getAllChildrenNodes(treeNode, str);
			// 加上被选择节点自己
			str = str + ',' + treeNode.id;
			// 去掉最前面的逗号
			var ids = str.substring(1, str.length);
			// 得到所有节点ID 的数组
			var idsArray = ids.split(',');
			//新增页面路径跳转
			
			Organizations.getDataForAllNodes(idsArray);
			// 得到节点总数量
			var length = idsArray.length;

			// 做业务操作
		}
		// 递归，获取所有子节点
		function getAllChildrenNodes(treeNode, result) {
			if(treeNode.isParent) {
				var childrenNodes = treeNode.children;
				if(childrenNodes) {
					for(var i = 0; i < childrenNodes.length; i++) {
						result += ',' + childrenNodes[i].id;
						result = getAllChildrenNodes(childrenNodes[i], result);
					}
				}
			}
			return result;
		}
		//获取所有节点的子节点--结束
		function onRename(e, treeId, treeNode) {
			showLog("[ " + getTime() + " onRename ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.name);
			console.log("5" + treeNode.name + "pId:" + treeNode.pId + "id:" + treeNode.id);
		}

		function showRemoveBtn(treeId, treeNode) {
			return !treeNode.isFirstNode;
		}

		function showRenameBtn(treeId, treeNode) {
			return !treeNode.isLastNode;
		}

		function showLog(str) {
			if(!log) log = $("#log");
			log.append("<li class='" + className + "'>" + str + "</li>");
			if(log.children("li").length > 8) {
				log.get(0).removeChild(log.children("li")[0]);
			}
		}

		function getTime() {
			var now = new Date(),
				h = now.getHours(),
				m = now.getMinutes(),
				s = now.getSeconds(),
				ms = now.getMilliseconds();
			return(h + ":" + m + ":" + s + " " + ms);
		}

		var newCount = 1;

		function addHoverDom(treeId, treeNode) {
			var sObj = $("#" + treeNode.tId + "_span");
			if(treeNode.editNameFlag || $("#addBtn_" + treeNode.id).length > 0) return;
			//进行权限控制按钮的添加
			var addStr = "<span class='button add' id='addBtn_" + treeNode.id +
				"' title='add node' onfocus='this.blur();'></span>";
			sObj.after(addStr);
			var btn = $("#addBtn_" + treeNode.id);
			if(btn) btn.bind("click", function() {
				var ztreeId = treeNode.id;
				$("#parentOrgId").val(ztreeId);
				//点击新增页面
				// 当前节点信息 id - 对应的是新增的pId
				window.location.href="userAdd.html";
				
			});
		};

		function removeHoverDom(treeId, treeNode) {
			$("#addBtn_" + treeNode.id).unbind().remove();
		};

		function selectAll() {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.setting.edit.editNameSelectAll = $("#selectAll").attr("checked");
		}

		$(document).ready(function() {
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			$("#selectAll").bind("click", selectAll);
		});
		//获取所有得的节点
		function getAllNode() {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			var zTteeDate = zTree.getNodes();
			var ztree = zTree.transformToArray(zTteeDate);
		}